<br /><br />

<script type="text/javascript">  
var point = new AMap.LngLat(121.5154, 31.3000 );//default location
var mapObj,tool,view,scale;
    function initialize() {  
        mapObj = new AMap.Map("map"); // 创建地图实例  
        //var point = new AMap.LngLat(116.404, 39.915); // 创建点坐标  
        mapObj.setCenter(point); // 设置地图中心点坐标  
        mapObj.plugin(["AMap.ToolBar","AMap.OverView","AMap.Scale"],function(){
       		var overview = new AMap.OverView();
       		mapObj.addControl(overview);
       		var toolbar = new AMap.ToolBar({
       			offset:new AMap.Pixel(30,100)

           		});
    		toolbar.autoPosition=true;

    		mapObj.addControl(toolbar);
    		var scale = new AMap.Scale();
    		mapObj.addControl(scale);

    });
        mapObj.scrollwheel=true;
        mapObj.keyboardEnable=true;
        mapObj.dragEnable=true;
        mapObj.doubleClickZoom=true;

        mapObj.bind(mapObj,"mousemove",fn);



        var marker = new AMap.Marker({
        	id:"m23",//唯一ID
        	position:new AMap.LngLat(121.5200,31.2979), //基点位置
        	icon:"http://api.amap.com/webapi/static/Images/marker_sprite.png", //marker图标，直接传递地址url
        	offset:{x:-8,y:-34} //相对于基点的位置
        	});
        var marker2 = new AMap.Marker({
        	id:"m24",//唯一ID
        	position:new AMap.LngLat(121.5169,31.2982), //基点位置
        	icon:"http://api.amap.com/webapi/static/Images/marker_sprite.png", //marker图标，直接传递地址url
        	offset:{x:-8,y:-34} //相对于基点的位置
        	});

    	
        	mapObj.addOverlays(marker);
        	mapObj.addOverlays(marker2);//将点添加到地图

        var info = [];
        info.push("&nbsp;&nbsp;<b>全日通</b>");
        info.push("&nbsp;&nbsp;电话 : 021-66121612   邮编 : 200433");
        info.push("&nbsp;&nbsp;地址 : 国定东路300号4号楼510室");
        
        var inforWindow = new AMap.InfoWindow({
        offset:new AMap.Pixel(45,-34),
        content:info.join("<br />")
        });
        mapObj.bind(marker,"click",function(e){
        inforWindow.open(mapObj,marker.getPosition());
        });
        
    }

    var fn = function(e){
    	document.getElementById("geo_pos").innerHTML = "鼠标当前位置："+e.lnglat.lng+","+e.lnglat.lat;
    	};


    function get_location(){
   	 if(navigator.geolocation){
   	  navigator.geolocation.getCurrentPosition(show_map);
   	 }else{
   	  alert("Your browser does not support HTML5 geoLocation");
   	 }
   	}

    function show_map(position){
   	 //显示地理信息
   	 var latitude = position.coords.latitude;
   	 var longitude = position.coords.longitude;
   	 alert("latitude="+latitude+" longitude="+longitude);
   	 //showObject(position,0);
    	//var mapObj = new AMap.Map("map"); // 创建地图实例  
        //point = new AMap.LngLat(longitude,latitude); // 创建点坐标  
     //alert("longitude="+longitude+" latitude="+latitude);
        //mapObj.setCenter(point); // 设置地图中心点坐标  
   	}



    //window.onload=get_location; 

</script>  
<div id="map"></div>
<div id="console" ><p>Console</p><p id="geo_pos"></p></div>
